Component({
    /**
     * 多插槽支持
     */
    options: {
        multipleSlots: true,
    },

    /**
     * 组件的属性列表
     */
    properties: {
        extClass: {
            type: String,
            value: "",
        },
        loading: {
            type: Boolean,
            value: false,
        },
        active: {
            type: Boolean,
            value: false,
        },
    },

    /**
     * 组件的初始数据
     */
    data: {},

    attached() {

        var _this = this
        var isSupport = !!wx.getMenuButtonBoundingClientRect

        var rect = wx.getMenuButtonBoundingClientRect ?
            wx.getMenuButtonBoundingClientRect() :
            null;
        console.log(rect);

        wx.getSystemInfo({
            success: function success(res) {
                var ios = !!(res.system.toLowerCase().search('ios') + 1)
                var statusBarHeight = res.statusBarHeight;
                var topBarHeight = ios ? (44 + statusBarHeight) : (48 + statusBarHeight);

                _this.setData({
                    ios: ios,
                    statusBarHeight: statusBarHeight,
                    innerWidth: isSupport ? 'width:' + rect.left + 'px' : '',
                    innerPaddingRight: isSupport ? 'padding-right:' + (res.windowWidth - rect.left) + 'px' : '',
                    leftWidth: isSupport ? 'width:' + (res.windowWidth - rect.left) + 'px' : ''
                })
            },
        });
    },

    /**
     * 组件的方法列表
     */
    methods: {
        doubleClick(e) {
            if (this.timeStamp && (e.timeStamp - this.timeStamp < 300)) {
                console.log(e.timeStamp - this.timeStamp);

                this.timeStamp = 0
                wx.pageScrollTo({
                    scrollTop: 0,
                    duration: 300
                })
            } else {
                this.timeStamp = e.timeStamp
            }
        }
    },
});